/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   Module Name          : com.yaodian100.ec.product.web.ProductSupplierApprove
   Module Description   :

   Date Created      : 2010/8/18
   Original Author   : feeling
   Team              : yaodian100
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   MODIFICATION HISTORY
   ------------------------------------------------------------------------------
   Date Modified       Modified by       Comments
   ------------------------------------------------------------------------------
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
package com.yaodian100.ec.product.web;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang.xwork.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import com.yaodian100.core.admin.entity.Role;
import com.yaodian100.core.admin.entity.User;
import com.yaodian100.core.admin.service.UserService;
import com.yaodian100.core.admin.utils.AdminHelper;
import com.yaodian100.core.common.dao.impl.CommonCriteria;
import com.yaodian100.core.common.entity.SimplePager;
import com.yaodian100.core.common.service.DomainService;
import com.yaodian100.core.common.utils.DateUtil;
import com.yaodian100.core.menu.entity.Menu;
import com.yaodian100.ec.product.entity.AddOnProduct;
import com.yaodian100.ec.product.entity.Product;
import com.yaodian100.ec.product.entity.ProductSupplierApprove;
import com.yaodian100.ec.product.service.ProductService;
import com.yaodian100.ec.product.service.ProductSupplierApproveService;
import com.yaodian100.ec.shelf.entity.Shelf;
import com.yaodian100.ec.shelf.service.ShelfService;
import com.yaodian100.ec.supplierapply.entity.SupplierApply;
import com.yaodian100.ec.supplierapply.service.SupplierApplyService;

/**
 * @author feeling
 * 
 */
public class ProductSupplierApproveAction extends ActionSupport implements Preparable {

	private static final long serialVersionUID = 6202839445099043620L;
	/**
	 * serial version
	 */
	private final Logger logger = LoggerFactory.getLogger(ProductSupplierApproveAction.class);
	@Resource
	private ProductService productService;
	@Resource
	private UserService userService;
	@Resource
	private DomainService<Menu> menuService;
	@Resource
	private SupplierApplyService supplierApplyService;
	@Resource
	private ShelfService shelfService;
	@Resource
	private ProductSupplierApproveService productSupplierApproveService;

	private CommonCriteria crit;
	private SimplePager pager;
	private List<User> users;
	private List<SupplierApply> supplierApplyList;
	private List<ProductSupplierApprove> productSupplierApproveList;
	private List<Shelf> shelfList;
	private Map<String, String> supplierApplyMap;
	private Map<String, Product> productMap;
	private Menu supplierApproveMenu;
	private String oldSupplierCompanyName;
	private String oldTwSupplierCompanyName;
	private String supplierCompanyName;
	private String twSupplierCompanyName;

	/*
	 * 查询页面参数
	 */
	private String productIdParam;
	private String applyUserParam;
	private String supplierParam;
	private String applyDateParam;

	/*
	 * 編輯頁面參數
	 */
	private String productId;
	private String applyUser;
	private String applyDate;
	private String newSupplierId;
	private String newCost;
	private String approveFailReason;
	private String id;
	private String approveStatus;
	private Product product;
	private ProductSupplierApprove productSupplierApprove;
	private Shelf shelf;
	private String loginUser;
	private String approve;
	private String hr24Result;
	private String oldSupplierId;
	private String oldTwSupplierId;
	private BigDecimal oldCost;
	private List<AddOnProduct> addonsMain = null;
	private List<AddOnProduct> addons = null;
	private List<AddOnProduct> nms = null;
	private boolean chkHasInventory;
	private String newTwSupplierId;

	public String search() throws Exception {
		loginUser = AdminHelper.getUser().getUsername();
		crit = new CommonCriteria();
		if (StringUtils.isNotBlank(supplierParam)) {
			crit.addEq("newSupplierId", supplierParam);
		}

		if (StringUtils.isNotBlank(productIdParam)) {
			crit.addEq("productId", productIdParam);
		}

		if (StringUtils.isNotBlank(applyUserParam)) {
			crit.addEq("applyUser", applyUserParam);
		}

		if (StringUtils.isNotBlank(applyDateParam)) {
			crit.addLe("applyDate", DateUtil.convertStringToDate(applyDate + " 23:59:59"));
		}
		int entitySize = 0;
		entitySize = productSupplierApproveService.getListSize(crit).intValue();
		pager.setTotalSize(entitySize);
		productSupplierApproveList = productSupplierApproveService.getList(pager.getCurrentPage() * pager.getPageRecord(),
				pager.getPageRecord(), crit, null);
		productMap = new HashMap<String, Product>();
		for (ProductSupplierApprove approve : productSupplierApproveList) {
			productMap.put(approve.getProductId(), productService.get(approve.getProductId()));
		}
		return "list";
	}

	public String add() throws Exception {
		init();
		if (StringUtils.isBlank(productId) || StringUtils.length(productId) != 8 || !NumberUtils.isNumber(productId)) {
			addActionError("传入参数错误");
			return search();
		}
		product = productService.get(productId);
		if (null == product) {
			addActionError("查无商品资料(或无该权限查看)");
			return search();
		} else {
			SupplierApply oldSupplierApply = supplierApplyService.get(product.getSupplierId());
			if (null == oldSupplierApply) {
				addActionError("供应商编号不存在：" + product.getSupplierId());
				return search();
			}
			// 台湾馆供应商
			if (Arrays.asList("010000", "010001").contains(product.getSupplierId())) {
				if (StringUtils.isBlank(product.getTwSupplierId())) {
					addActionError("查无台湾馆供应商资料");
					return search();
				} else {
					SupplierApply oldTwSupplierApply = supplierApplyService.get(product.getTwSupplierId());
					logger.info("oldTwSupplierApply:{}", oldTwSupplierApply);
					if (null == oldTwSupplierApply) {
						addActionError("台湾馆供应商编号不存在：" + product.getTwSupplierId());
						return search();
					}
					logger.info("name:{}", oldTwSupplierApply.getCompanyName());
					oldTwSupplierCompanyName = oldTwSupplierApply.getCompanyName();
					oldTwSupplierId = product.getTwSupplierId();
				}
			}
			shelf = shelfService.getActiveShelfByProductId(productId);
			oldCost = product.getProductCost();
			oldSupplierId = product.getSupplierId();
			oldSupplierCompanyName = oldSupplierApply.getCompanyName();
			crit = new CommonCriteria();
			crit.addEq("productId", productId);
			crit.addGe("endDate", new Date());
			// 取得上架資料
			shelfList = shelfService.getList(0, -1, crit, new String[] { "startDate asc" });
		}
		return "edit";
	}

	public String jsonChk24Hr() throws Exception {
		// hr24Result = null;
		// if (StringUtils.isBlank(id)) {
		// hr24Result = "传入参数错误:id=" + id;
		// } else {
		// productSupplierApprove = productSupplierApproveService.get(Long.parseLong(id));
		// // 申請後24小時的日期
		// Date hr24 = DateUtils.addDays(productSupplierApprove.getApplyDate(), 1);
		// // logger.info("hr24:{}", hr24);
		// // logger.info("Date:{}", new Date());
		// // logger.info("xxxx:{}", new Date().before(hr24));
		// if (new Date().before(hr24)) {
		// hr24Result = "24小时内不可再异动";
		// }
		// }
		// return "jsonChk24Hr";
		crit = new CommonCriteria();
		crit.addEq("productId", product.getProductId());
		crit.addEq("approveStatus", "30");
		List<ProductSupplierApprove> psaList = productSupplierApproveService.getList(0, -1, crit,
				new String[] { "createDate desc" });
		if (null != psaList) {
			// 審核成功/失敗後24小時的日期
			Date hr24 = DateUtils.addDays(psaList.get(0).getApproveDate(), 1);
			if (new Date().before(hr24)) {
				hr24Result = "24小时内不可再异动";
			}
		}
		return "jsonChk24Hr";
	}

	public String edit() throws Exception {
		oldTwSupplierId = null;
		oldTwSupplierCompanyName = null;
		if (StringUtils.isBlank(id)) {
			addActionError("传入参数错误");
			return search();
		} else {
			productSupplierApprove = productSupplierApproveService.get(Long.parseLong(id));
			if (null == productSupplierApprove) {
				addActionError("查无商品供应商审核资料(或无该权限查看)");
				return search();
			}
			if (StringUtils.isBlank(productSupplierApprove.getProductId())) {
				addActionError("传入参数错误");
				return search();
			} else {
				productId = productSupplierApprove.getProductId();
				product = productService.get(productId);
				if (null == product) {
					addActionError("查无商品资料(或无该权限查看)");
					return search();
				} else {
					SupplierApply oldSupplierApply = supplierApplyService.get(productSupplierApprove.getOldSupplierId());
					if (null == oldSupplierApply) {
						addActionError("供应商编号不存在：" + productSupplierApprove.getOldSupplierId());
						return search();
					}
					if (Arrays.asList("010000", "010001").contains(productSupplierApprove.getOldSupplierId())
							&& StringUtils.isNotBlank(product.getTwSupplierId())) {
						SupplierApply oldTwSupplierApply = supplierApplyService.get(product.getTwSupplierId());
						if (null == oldTwSupplierApply) {
							addActionError("供应商编号不存在：" + product.getTwSupplierId());
							return search();
						}
						oldTwSupplierId = product.getTwSupplierId();
						oldTwSupplierCompanyName = oldTwSupplierApply.getCompanyName();
					}
					if (StringUtils.isNotBlank(productSupplierApprove.getNewSupplierId())) {
						SupplierApply supplierApply = supplierApplyService.get(productSupplierApprove.getNewSupplierId());
						if (null == supplierApply) {
							addActionError("供应商编号不存在：" + productSupplierApprove.getNewSupplierId());
							return search();
						}
						supplierCompanyName = supplierApply.getCompanyName();
						if (Arrays.asList("010000", "010001").contains(productSupplierApprove.getNewSupplierId())) {// 台湾馆供应商
							SupplierApply twSupplierApply = supplierApplyService.get(productSupplierApprove.getNewTwSupplierId());
							if (null == twSupplierApply) {
								addActionError("供应商编号不存在：" + productSupplierApprove.getNewTwSupplierId());
								return search();
							}
							twSupplierCompanyName = twSupplierApply.getCompanyName();
						}
					}
					shelf = shelfService.getActiveShelfByProductId(productId);
					oldCost = product.getProductCost();
					oldSupplierId = product.getSupplierId();
					oldSupplierCompanyName = oldSupplierApply.getCompanyName();

					crit = new CommonCriteria();
					crit.addEq("productId", productId);
					crit.addGe("endDate", new Date());
					// 取得上架資料
					shelfList = shelfService.getList(0, -1, crit, new String[] { "startDate asc" });

					crit = new CommonCriteria();
					crit.addEq("mainProductId", product.getProductId());
					crit.addGe("addOnPrice", new BigDecimal(0));
					crit.addEq("isDelete", "N");
					crit.addLe("startDate", new Date());
					crit.addGe("endDate", new Date());
					addonsMain = productService.getAddOnProductList(0, -1, crit, null);

					crit = new CommonCriteria();
					crit.addEq("addOnProductId", product.getProductId());
					crit.addGe("addOnPrice", new BigDecimal(0));
					crit.addEq("isDelete", "N");
					crit.addLe("startDate", new Date());
					crit.addGe("endDate", new Date());
					addons = productService.getAddOnProductList(0, -1, crit, null);

					crit = new CommonCriteria();
					crit.addEq("addOnProductId", product.getProductId());
					crit.addGe("addOnPrice", new BigDecimal(-1));
					crit.addEq("isDelete", "N");
					crit.addLe("startDate", new Date());
					crit.addGe("endDate", new Date());
					nms = productService.getAddOnProductList(0, -1, crit, null);
					chkHasInventory = productService.chkProductHasInventory(product);
				}
			}
		}
		return "edit";
	}

	/**
	 * @return
	 * @throws Exception
	 */
	public String saveApprove() throws Exception {
		if (StringUtils.isBlank(id)) {
			addActionError("传入参数错误");
			return edit();
		} else {
			loginUser = AdminHelper.getUser().getUsername();
			productSupplierApprove = productSupplierApproveService.get(Long.parseLong(id));
			if (StringUtils.isBlank(productSupplierApprove.getProductId())) {
				addActionError("传入参数错误");
				return edit();
			} else {
				productId = productSupplierApprove.getProductId();
				product = productService.get(productId);
				if (null == product) {
					addActionError("查无商品资料(或无该权限查看)");
					return edit();
				} else {
					SupplierApply newSp = supplierApplyService.get(productSupplierApprove.getNewSupplierId());
					if (null != newSp && newSp.getStatus() == 1 && newSp.getApproveStatus() != 1) {
						productSupplierApprove.setApproveStatus(approveStatus);
						productSupplierApprove.setApproveUser(loginUser);
						productSupplierApprove.setApproveDate(new Date());
						if (StringUtils.equals("40", approveStatus)) {
							if (StringUtils.isNotBlank(approveFailReason)) {
								productSupplierApprove.setApproveFailReason(approveFailReason);
							} else {
								addActionError("请输入审核失败理由");
								return edit();
							}
						}
						productSupplierApproveService.save(productSupplierApprove);
						// 审核成功后，修改商品供应商资料,並同步至後台
						if (StringUtils.equals("30", productSupplierApprove.getApproveStatus())) {
							Product product = productService.get(productSupplierApprove.getProductId());
							product.setSupplierId(productSupplierApprove.getNewSupplierId());
							product.setProductCost(productSupplierApprove.getNewCost());
							if (Arrays.asList("010000", "010001").contains(productSupplierApprove.getNewSupplierId())) {
								product.setTwSupplierId(productSupplierApprove.getNewTwSupplierId());
							} else {
								product.setTwSupplierId("");
							}
							productService.save(product);
						}
					} else {
						addActionError("新供应商已停用或未被审核:status=" + newSp.getStatus() + ",approveStatus=" + newSp.getApproveStatus());
						id = productSupplierApprove.getId().toString();
						approve = null;
						return edit();
					}
				}
			}
		}
		id = productSupplierApprove.getId().toString();
		approve = null;
		return view();
	}

	public String save() throws Exception {
		if (StringUtils.isBlank(id)) {
			productSupplierApprove = new ProductSupplierApprove();
		} else {
			productSupplierApprove = productSupplierApproveService.get(Long.parseLong(id));
		}
		if (null == productSupplierApprove) {
			addActionError("查无商品供应商审核资料(或无该权限查看)");
			return "edit";
		}
		if (StringUtils.isBlank(productId)) {
			addActionError("传入参数错误");
			return "edit";
		}
		product = productService.get(productId);
		if (null == product) {
			addActionError("查无商品资料(或无该权限查看)");
			return "edit";
		}
		SupplierApply newSp = supplierApplyService.get(newSupplierId);
		if (null != newSp) {
			if (newSp.getStatus() == 1 && newSp.getApproveStatus() != 1) {
				loginUser = AdminHelper.getUser().getUsername();
				productSupplierApprove.setApplyDate(new Date());
				productSupplierApprove.setApplyUser(loginUser);
				productSupplierApprove.setOldSupplierId(oldSupplierId);
				productSupplierApprove.setOldCost(product.getProductCost().setScale(2, RoundingMode.FLOOR));
				productSupplierApprove.setNewCost(new BigDecimal(newCost).setScale(2, RoundingMode.FLOOR));
				productSupplierApprove.setNewSupplierId(newSupplierId);
				productSupplierApprove.setProductId(productId);
				productSupplierApprove.setApproveStatus(approveStatus);
				if (Arrays.asList("010000", "010001").contains(newSupplierId)) {// 台湾馆供应商
					SupplierApply newTwSp = supplierApplyService.get(newTwSupplierId);
					if (null != newTwSp) {
						if (newTwSp.getStatus() == 1 && newTwSp.getApproveStatus() != 1) {
							productSupplierApprove.setNewTwSupplierId(newTwSupplierId);
						} else {
							addActionError("台湾馆供应商已停用或未被审核:status=" + newTwSp.getStatus() + ",approveStatus="
									+ newTwSp.getApproveStatus());
							return "edit";
						}
					} else {
						addActionError("台湾馆供应商编号：" + newTwSupplierId + "不存在");
						return "edit";
					}
				} else {
					productSupplierApprove.setNewTwSupplierId("");
				}
				productSupplierApproveService.save(productSupplierApprove);
				addActionError("储存成功");
				id = productSupplierApprove.getId().toString();
				return view();
			} else {
				addActionError("新供应商已停用或未被审核:status=" + newSp.getStatus() + ",approveStatus=" + newSp.getApproveStatus());
				return "edit";
			}
		} else {
			addActionError("新供应商编号：" + newSupplierId + "不存在");
			return "edit";
		}
	}

	public String view() throws Exception {
		oldTwSupplierId = null;
		oldTwSupplierCompanyName = null;
		if (StringUtils.isBlank(id)) {
			addActionError("传入参数错误");
			return search();
		} else {
			productSupplierApprove = productSupplierApproveService.get(Long.parseLong(id));
			if (null == productSupplierApprove) {
				return search();
			}
			// 取得商品资料
			product = productService.get(productSupplierApprove.getProductId());
			if (null == product) {
				addActionError("查无商品资料(或无该权限查看)");
				return search();
			} else {
				SupplierApply oldSupplierApply = supplierApplyService.get(productSupplierApprove.getOldSupplierId());
				if (null == oldSupplierApply) {
					addActionError("供应商编号不存在：" + productSupplierApprove.getOldSupplierId());
					return search();
				}
				if (Arrays.asList("010000", "010001").contains(productSupplierApprove.getOldSupplierId())
						&& StringUtils.isNotBlank(product.getTwSupplierId())) {
					SupplierApply oldTwSupplierApply = supplierApplyService.get(product.getTwSupplierId());
					if (null == oldTwSupplierApply) {
						addActionError("供应商编号不存在：" + product.getTwSupplierId());
						return search();
					}
					oldTwSupplierId = product.getTwSupplierId();
					oldTwSupplierCompanyName = oldTwSupplierApply.getCompanyName();
				}
				if (StringUtils.isNotBlank(productSupplierApprove.getNewSupplierId())) {
					SupplierApply supplierApply = supplierApplyService.get(productSupplierApprove.getNewSupplierId());
					if (null == supplierApply) {
						addActionError("供应商编号不存在：" + newSupplierId);
						return search();
					}
					supplierCompanyName = supplierApply.getCompanyName();
					if (Arrays.asList("010000", "010001").contains(productSupplierApprove.getNewSupplierId())) {
						SupplierApply twSupplierApply = supplierApplyService.get(productSupplierApprove.getNewTwSupplierId());
						if (null == twSupplierApply) {
							addActionError("台湾馆供应商编号不存在：" + newTwSupplierId);
							return search();
						}
						twSupplierCompanyName = twSupplierApply.getCompanyName();
					}
				}
				shelf = shelfService.getActiveShelfByProductId(product.getProductId());
				oldSupplierCompanyName = oldSupplierApply.getCompanyName();
				crit = new CommonCriteria();
				crit.addEq("productId", product.getProductId());
				crit.addGe("endDate", new Date());
				// 取得上架資料
				shelfList = shelfService.getList(0, -1, crit, new String[] { "startDate asc" });
			}
		}
		return "view";
	}

	public void init() throws Exception {
		product = null;
		productSupplierApprove = null;
		productIdParam = null;
		applyUserParam = null;
		supplierParam = null;
		applyDateParam = null;
		supplierCompanyName = null;
		hr24Result = null;
		approve = null;
		shelf = null;
		shelfList = null;
		id = null;
		oldTwSupplierId = null;
		oldTwSupplierCompanyName = null;
	}

	@Override
	public void prepare() throws Exception {
		clearErrorsAndMessages();
		if (StringUtils.isNotBlank(productIdParam)) {
			product = productService.get(productIdParam);
		}
		if (null == pager) {
			pager = new SimplePager();
		}
		pager.setPageRecord(20);// defaut 20

		// 找出所有ｐｍ的user
		if (null == users) {
			users = userService.getByRole(Role.Default.PM.name(), Role.Type.OTHER);
		}

		if (null == supplierApplyList) {
			// crit = new CommonCriteria();
			// crit.addEq("approveStatus", SupplierApply.APPROVE_APPROVED);
			// crit.addEq("status", SupplierApply.ACTIVE);
			// supplierApplyList = supplierApplyService
			// .getList(0, supplierApplyService.getListSize(crit).intValue(), crit, null);
			supplierApplyList = supplierApplyService.getList(0, -1, crit, new String[] { "supplierID asc" });
			supplierApplyMap = new HashMap<String, String>();
			for (SupplierApply supplierApply : supplierApplyList) {
				supplierApplyMap.put(supplierApply.getSupplierID(), supplierApply.getCompanyName());
			}
		}
		if (null == supplierApproveMenu) {
			supplierApproveMenu = menuService.get("Product.SupplierApprove");
		}
	}

	public SimplePager getPager() {
		return pager;
	}

	public void setPager(SimplePager pager) {
		this.pager = pager;
	}

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	public String getProductIdParam() {
		return productIdParam;
	}

	public void setProductIdParam(String productIdParam) {
		this.productIdParam = productIdParam;
	}

	public String getApplyDateParam() {
		return applyDateParam;
	}

	public void setApplyDateParam(String applyDateParam) {
		this.applyDateParam = applyDateParam;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public void setProductService(ProductService productService) {
		this.productService = productService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public void setMenuService(DomainService<Menu> menuService) {
		this.menuService = menuService;
	}

	public void setSupplierApplyService(SupplierApplyService supplierApplyService) {
		this.supplierApplyService = supplierApplyService;
	}

	public String getApplyUserParam() {
		return applyUserParam;
	}

	public void setApplyUserParam(String applyUserParam) {
		this.applyUserParam = applyUserParam;
	}

	public void setProductSupplierApproveService(ProductSupplierApproveService productSupplierApproveService) {
		this.productSupplierApproveService = productSupplierApproveService;
	}

	public List<ProductSupplierApprove> getProductSupplierApproveList() {
		return productSupplierApproveList;
	}

	public void setProductSupplierApproveList(List<ProductSupplierApprove> productSupplierApproveList) {
		this.productSupplierApproveList = productSupplierApproveList;
	}

	public String getProductId() {
		return productId;
	}

	public void setProductId(String productId) {
		this.productId = productId;
	}

	public String getApplyUser() {
		return applyUser;
	}

	public void setApplyUser(String applyUser) {
		this.applyUser = applyUser;
	}

	public String getApplyDate() {
		return applyDate;
	}

	public void setApplyDate(String applyDate) {
		this.applyDate = applyDate;
	}

	public String getNewSupplierId() {
		return newSupplierId;
	}

	public void setNewSupplierId(String newSupplierId) {
		this.newSupplierId = newSupplierId;
	}

	public String getApproveFailReason() {
		return approveFailReason;
	}

	public void setApproveFailReason(String approveFailReason) {
		this.approveFailReason = approveFailReason;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public ProductSupplierApprove getProductSupplierApprove() {
		return productSupplierApprove;
	}

	public void setProductSupplierApprove(ProductSupplierApprove productSupplierApprove) {
		this.productSupplierApprove = productSupplierApprove;
	}

	public List<SupplierApply> getSupplierApplyList() {
		return supplierApplyList;
	}

	public void setSupplierApplyList(List<SupplierApply> supplierApplyList) {
		this.supplierApplyList = supplierApplyList;
	}

	public Menu getSupplierApproveMenu() {
		return supplierApproveMenu;
	}

	public void setSupplierApproveMenu(Menu supplierApproveMenu) {
		this.supplierApproveMenu = supplierApproveMenu;
	}

	public ShelfService getShelfService() {
		return shelfService;
	}

	public void setShelfService(ShelfService shelfService) {
		this.shelfService = shelfService;
	}

	public List<Shelf> getShelfList() {
		return shelfList;
	}

	public void setShelfList(List<Shelf> shelfList) {
		this.shelfList = shelfList;
	}

	public String getNewCost() {
		return newCost;
	}

	public void setNewCost(String newCost) {
		this.newCost = newCost;
	}

	public String getApproveStatus() {
		return approveStatus;
	}

	public void setApproveStatus(String approveStatus) {
		this.approveStatus = approveStatus;
	}

	public String getSupplierParam() {
		return supplierParam;
	}

	public void setSupplierParam(String supplierParam) {
		this.supplierParam = supplierParam;
	}

	public String getOldSupplierCompanyName() {
		return oldSupplierCompanyName;
	}

	public void setOldSupplierCompanyName(String oldSupplierCompanyName) {
		this.oldSupplierCompanyName = oldSupplierCompanyName;
	}

	public String getSupplierCompanyName() {
		return supplierCompanyName;
	}

	public void setSupplierCompanyName(String supplierCompanyName) {
		this.supplierCompanyName = supplierCompanyName;
	}

	public Shelf getShelf() {
		return shelf;
	}

	public void setShelf(Shelf shelf) {
		this.shelf = shelf;
	}

	public Map<String, String> getSupplierApplyMap() {
		return supplierApplyMap;
	}

	public void setSupplierApplyMap(Map<String, String> supplierApplyMap) {
		this.supplierApplyMap = supplierApplyMap;
	}

	public Map<String, Product> getProductMap() {
		return productMap;
	}

	public void setProductMap(Map<String, Product> productMap) {
		this.productMap = productMap;
	}

	public String getLoginUser() {
		return loginUser;
	}

	public void setLoginUser(String loginUser) {
		this.loginUser = loginUser;
	}

	public String getApprove() {
		return approve;
	}

	public void setApprove(String approve) {
		this.approve = approve;
	}

	public String getHr24Result() {
		return hr24Result;
	}

	public void setHr24Result(String hr24Result) {
		this.hr24Result = hr24Result;
	}

	public String getOldSupplierId() {
		return oldSupplierId;
	}

	public void setOldSupplierId(String oldSupplierId) {
		this.oldSupplierId = oldSupplierId;
	}

	public BigDecimal getOldCost() {
		return oldCost;
	}

	public void setOldCost(BigDecimal oldCost) {
		this.oldCost = oldCost;
	}

	public List<AddOnProduct> getAddons() {
		return addons;
	}

	public void setAddons(List<AddOnProduct> addons) {
		this.addons = addons;
	}

	public List<AddOnProduct> getNms() {
		return nms;
	}

	public void setNms(List<AddOnProduct> nms) {
		this.nms = nms;
	}

	public List<AddOnProduct> getAddonsMain() {
		return addonsMain;
	}

	public void setAddonsMain(List<AddOnProduct> addonsMain) {
		this.addonsMain = addonsMain;
	}

	public boolean isChkHasInventory() {
		return chkHasInventory;
	}

	public void setChkHasInventory(boolean chkHasInventory) {
		this.chkHasInventory = chkHasInventory;
	}

	public String getNewTwSupplierId() {
		return newTwSupplierId;
	}

	public void setNewTwSupplierId(String newTwSupplierId) {
		this.newTwSupplierId = newTwSupplierId;
	}

	public String getTwSupplierCompanyName() {
		return twSupplierCompanyName;
	}

	public void setTwSupplierCompanyName(String twSupplierCompanyName) {
		this.twSupplierCompanyName = twSupplierCompanyName;
	}

	public String getOldTwSupplierCompanyName() {
		return oldTwSupplierCompanyName;
	}

	public String getOldTwSupplierId() {
		return oldTwSupplierId;
	}

	public void setOldTwSupplierCompanyName(String oldTwSupplierCompanyName) {
		this.oldTwSupplierCompanyName = oldTwSupplierCompanyName;
	}

	public void setOldTwSupplierId(String oldTwSupplierId) {
		this.oldTwSupplierId = oldTwSupplierId;
	}
}